package topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import utils.RabbitMQUtils;

/**
 * @author lucine
 * @version 1.0 2021/6/20 12:18
 */
public class Provider {
    public static void main(String[] args) throws Exception {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        String routingKey = "user.save";
        String exchangeName = "testTopics";
        channel.exchangeDeclare(exchangeName,"topic");
        channel.basicPublish(exchangeName,routingKey,null,("这是topic动态路由模型 routingKey = +["+routingKey+"]的消息").getBytes());


        RabbitMQUtils.cloneConnectionAndChannel(channel,connection);

    }
}
